package org.streets.eis.setting.converters;

import java.util.Locale;

import org.apache.wicket.util.convert.IConverter;
import org.apache.wicket.util.convert.converters.BooleanConverter;

public class BoolConverter extends BooleanConverter{

	private static final long serialVersionUID = 1L;

	public static final IConverter INSTANCE = new BoolConverter();

	public Object convertToObject(final String value, Locale locale){
		if ("是".equals(value)){
			return Boolean.TRUE;
		} else if ("否".equals(value)){
			return Boolean.FALSE; 
		} else {
			return super.convertToObject(value, locale);
		}
	}
	
	@Override
	public String convertToString(final Object value, Locale locale){
		return ((Boolean)value).booleanValue() ? "是":"否";
	}
	
}
